package com.xoa.dev.pz.controller;

import com.xoa.dev.pz.model.PzKeyYouthWithBLOBs;
import com.xoa.dev.pz.service.impl.PzKeyYouthService;
import com.xoa.util.ToJson;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

@Controller
@RequestMapping("/keyYouth")
public class PzKeyYouthController {
    @Resource
    private PzKeyYouthService pzKeyYouthService;

  /**
     * 分页查询及导出
     * @param pzKeyYouthWithBLOBs
     * @param page
     * @param pageSize
     * @param userFlag
     * @return
     */
    @ResponseBody
    @RequestMapping("/selectService")
    public ToJson<PzKeyYouthWithBLOBs> selectService(HttpServletResponse response, HttpServletRequest request, PzKeyYouthWithBLOBs pzKeyYouthWithBLOBs,
                                                     Integer page, Integer pageSize, boolean useFlag, String export, String pCradId, String pName){
        return pzKeyYouthService.selectService(response,request,pzKeyYouthWithBLOBs,page,pageSize,useFlag,export,pCradId,pName);
    }

    /**
     * 插入
     * @param pzKeyYouthWithBLOBs
     * @return
     */
    @ResponseBody
    @RequestMapping("/insertSelective")
    public ToJson insertSelective(HttpServletRequest request, PzKeyYouthWithBLOBs pzKeyYouthWithBLOBs){
        return pzKeyYouthService.insertSelective(request,pzKeyYouthWithBLOBs);
    }

    /**
     * 主键删除
     * @param keyYouthId
     * @return
     */
    @ResponseBody
    @RequestMapping("/deleteByPrimaryKey")
    public ToJson deleteByPrimaryKey(HttpServletRequest request, int keyYouthId){
        return pzKeyYouthService.deleteByPrimaryKey(request,keyYouthId);
    }

    /**
     * 更新
     * @param pzKeyYouthWithBLOBs
     * @return
     */
    @ResponseBody
    @RequestMapping("/upServiceById")
    public ToJson upServiceById(HttpServletRequest request, PzKeyYouthWithBLOBs pzKeyYouthWithBLOBs){
        return pzKeyYouthService.upServiceById(request,pzKeyYouthWithBLOBs);
    }

    /**
     * 主键查询
     * @param keyYouthId
     * @return
     */
    @ResponseBody
    @RequestMapping("/selectById")
    public ToJson<PzKeyYouthWithBLOBs> selectById(int keyYouthId, HttpServletRequest request){
        return pzKeyYouthService.selectById(keyYouthId,request);
    }

    @ResponseBody
    @RequestMapping("/importPzKeyYouthAcess")
    public ToJson importPzKeyYouthAcess(HttpServletRequest request, HttpServletResponse response, MultipartFile file, HttpSession session){
        return  pzKeyYouthService.importPzKeyYouthAcess(request,response,file,session);
    }

}
